package com.acme.bankapp.domain.bank;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class Bank {

	private HashSet<Client> clients;
	private ClientRegistrationListener[] listeners;

	public Bank() {
		clients = new HashSet<Client>();
	}

	public Bank(ClientRegistrationListener[] listeners) {
		clients = new HashSet<Client>();
		this.listeners = listeners;
	}

	public void addClient(Client client) {
		clients.add(client);
		for (ClientRegistrationListener listener : listeners) {
			listener.onClientAdded(client);
		}
	}

	public Set<Client> getClients() {
		return Collections.unmodifiableSet(clients);
	}

}
